package com.maybach.common.enums.order;

/**
 * Created by zhaoshuai on 16/2/26.
 */
public enum InfoTypeEnum {

    MarginImgs("margin", "保证金凭证"),//保证金凭证照片
    DepositImgs("deposit", "定金凭证"),//定金凭证照片
    ContractImgs("contract", "购车合同"),//购车合同照片
    DaifuImgs("daifu", "代付凭证"),//代付凭证图片
    DaigouImgs("daigou", "代购协议"),//代购协议图片
    ;

    private String type;

    private String desc;

    InfoTypeEnum(String type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    public String getType() {
        return type;
    }

    public String getDesc() {
        return desc;
    }

    public static String getDescByName(String name) {
        for (InfoTypeEnum infoTypeEnum : InfoTypeEnum.values()) {
            if (infoTypeEnum.name().equals(name)) {
                return infoTypeEnum.desc;
            }
        }
        return null;
    }

    public static String getDescByType(String type) {
        for (InfoTypeEnum infoTypeEnum : InfoTypeEnum.values()) {
            if (infoTypeEnum.type.equals(type)) {
                return infoTypeEnum.desc;
            }
        }
        return null;
    }

    public static String getNameByType(String type) {
        for (InfoTypeEnum infoTypeEnum : InfoTypeEnum.values()) {
            if (infoTypeEnum.type.equals(type)) {
                return infoTypeEnum.name();
            }
        }
        return null;
    }

    public static InfoTypeEnum getEnumByName(String name) {
        for (InfoTypeEnum infoTypeEnum : InfoTypeEnum.values()) {
            if (infoTypeEnum.name().equals(name)) {
                return infoTypeEnum;
            }
        }
        return null;
    }
}
